
//Namespace
package com.katujo.squirrel.annotations;

//Java imports
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * The squirrel column pattern annotation. Tells the squirrel what pattern
 * to use for fields to columns mapping. 
 * <p>
 * This can be used on a SquirrelManager extended class or on a object that
 * is to be persisted. It will try to use the lowest order of the annotation 
 * so the order is as follows, Object, SquirrelManager, default.
 * </p>
 * <p>
 * If this annotation is not set it will default to the JAVA pattern. 
 * </p>
 * 
 * <br/><br/>
 * Copyright 2010 Katujo LTD<br/>
 * Licensed under the Apache License, Version 2.0<br/>
 * (the "License"); you may not use this file except in compliance with the License. You may<br/>
 * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required <br/>
 * by applicable law or agreed to in writing, software distributed under the License is distributed <br/>
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either <br/>
 * express or implied. See the License for the specific language governing permissions and <br/>
 * limitations under the License. <br/>
 * 
 * @author Johan Hertz
 *
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface ColumnPattern
{
	/**
	 * The pattern to user when persisting a field to a column.
	 */
	public enum Pattern
	{		
		/**
		 * Use the java field name without any changes. 
		 */
		JAVA,
		
		/**
		 * Use the java name but changes the first character 
		 * of the field name to upper case.
		 */
		JAVA_FIRST_UPPER,
		
		/**
		 * Change all characters to upper case and inserts underscore 
		 * to separate words.
		 * <p>
		 *  someField => SOME_FIELD
		 * </p>
		 */
		UPPER_CASE,
		
		/**
		 * Change all characters to lower case and inserts underscore 
		 * to separate words.
		 * <p>
		 *  someField => some_field
		 * </p>
		 */
		LOWER_CASE		
	}	
	
	/**
	 * The pattern for field name to column name;
	 * @return
	 */
	Pattern pattern();	
}
